import React, { Component } from 'react'
import store from '../store'
export default class Brother2 extends Component {
    constructor() {
        super()
        this.state = {
            num: store.getState().count,
            name: store.getState().user
        }
    }
    componentDidMount() {
        store.subscribe(() => {
            this.setState({
                num: store.getState().count,
                name: store.getState().user

            })
        })
    }
    render() {
        return (
            <div>
                <h2>brother2</h2>
                <h2>仓库中最新值</h2>
                <h3>{this.state.num}</h3>
                <h3>{this.state.name}</h3>

            </div>
        )
    }
}